package com.guigu.www.tangyingmeng.controller;


import com.guigu.www.pojo.*;
import com.guigu.www.tangyingmeng.service.TymInterventionTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/template")
public class TymInterventionController {

    @Autowired
    private TymInterventionTemplateService service;

    @PostMapping("/seltemplateall")
    public PageVo<InterventionTemplate> seltemplateall(@RequestBody Map<String,String> map){
        PageVo<InterventionTemplate> pageVo = service.seltemplateall(map);
        return pageVo;
    }

    @GetMapping("seltemplateone/{id}")
    public InterventionTemplate seltemplateone(@PathVariable("id") Integer id){
        InterventionTemplate template = service.seltemplateone(id);
        return template;
    }

    @GetMapping("deltemplate/{id}")
    public Boolean deltemplate(@PathVariable("id") Integer id){
        Boolean falg = service.deltemplate(id);
        return falg;
    }

    @PostMapping("/addtemplate")
    public Boolean addtemplate(@RequestBody InterventionTemplate template){
        Boolean falg = service.addtemplate(template);
        return falg;
    }

    @PostMapping("/uptemplate")
    public Boolean uptemplate(@RequestBody InterventionTemplate template){
        Boolean falg = service.uptemplate(template);
        return falg;
    }

    @GetMapping("jing/{id}")
    public Boolean jing(@PathVariable("id") Integer id){
        Boolean falg = service.jing(id);
        return falg;
    }

    @GetMapping("qi/{id}")
    public Boolean qi(@PathVariable("id") Integer id){
        Boolean falg = service.qi(id);
        return falg;
    }

    @PostMapping("/selwholesomeall")
    public List<TemplateWholesome> selwholesomeall () {
        List<TemplateWholesome> list = service.selwholesomeall();
        // System.out.println(list);
        return list;
    }

    @PostMapping("/selfoodall")
    public List<FoodZong> selfoodall () {
        List<FoodZong> list = service.selfoodall();
        // System.out.println(list);
        return list;
    }

    @PostMapping("/selkeepall")
    public List<KeepZong> selkeepall () {
        List<KeepZong> list = service.selkeepall();
        // System.out.println(list);
        return list;
    }

}
